    #define COMPOSITION

#include <map>
#include <string>
#include <queue>
#define TICK_TIME 0.5f
//#include <array>
using namespace std;
#define pr(s) printf("%s\n", s)
#define prx(s) printf("0x%X\n", s)

struct game_machine
{
    // "data oriented"
	float & timeSinceLastFrame;
    game_machine();
    // characters
	std::vector <std::string>CharNames;
	std::vector <character_s>Characters;
    std::map <std::string, short> CharIds;
    
    std::vector<ability> Abilities;
    std::vector<string> AbilNames;
    std::map<string, short> AbilIds;

    

//	std::vector<timer_state> Timers;
//	std::queue<size_t> availables;
    object_pool<timer_state> Timers;
    Bar bar;
    //sf_cons console;
    //ItemMgr item_mgr;
    /***************************************************************/
    // STARTUP
	game_machine(float & f);
	int make_abil_mask(string flags)
    {
        size_t n = flags.size();
        int ret = 0;
        for(size_t i = 0; i < n; ++i)
            if(flags[i] == '1')
                ret += (1 << i);
        return ret;
    }
    void load_abilities();
    void diagnose();
    // LOOP
	void update();
    string inspect_cast(short emit, short abil, short target); 
    
    void set_target (short emit, short target);
	void cast_cmd   (short emit, short abil, short target);
	void cast_start (short emit, short abil, short target);
    void cast_launch(short emit, short abil, short target);
	void cast_land  (short emit, short abil, short target);
    void cast_dot   (short emit, short abil, short target);

    void damage_msg(short emit, short target, short dmg);
    void error_message (err_msg);
    //Vec3 click_position;
    Vec3 click_position, projectile;

};
